package models.domain;

import models.data.Afangar;
import models.data.Leitarskilyrdi;
import models.data.Svor;
import play.data.format.Formats;
import play.data.validation.Constraints;
import play.db.ebean.Model;
import play.mvc.Http;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Olga
 * Date: 23.2.2013
 * Time: 18:17
 * To change this template use File | Settings | File Templates.
 */
@Entity
public class Question extends Model {

    private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yyyy");


    public int spurningar_id;
    public String tegund;
    public int onn_id;
    public String texti;
    public String afangi_id;
    public int tyngdarstig;
    public String kennari_id;
    @Formats.DateTime(pattern="yyyy-MM-dd")
    public Date dagurstofnad;
    public String bok_heiti;
    public String tyngdarstig_heiti;
    public String namsgrein_afanganr;

    public String dagurbuidtil;

    //use if question is changed
    public Date dagurbreytt;
    public int spurningbreytt_id;

    public String kafli;
    @Transient
    public Http.MultipartFormData.FilePart vidhengi;
    public String nr_utgafu;
    public String hofundur_bokar;

    public List<Leitarskilyrdi> tags;

    public Question() {

    }

    public Question(int spurningar_id, String tegund, int onn_id, String texti, String afangi_id, int tyngdarstig, String kennari_id, String kafli, Http.MultipartFormData.FilePart vidhengi, String nr_utgafu, String hofundur_bokar, Date dagurstofnad,String bok_heiti, String namsgrein_afanganr) {
        this.spurningar_id = spurningar_id;
        this.tegund = tegund;
        this.onn_id = onn_id;
        this.texti = texti;
        this.afangi_id = afangi_id;
        this.tyngdarstig = tyngdarstig;
        this.kennari_id = kennari_id;
        this.kafli = kafli;
        this.vidhengi = vidhengi;
        this.nr_utgafu = nr_utgafu;
        this.hofundur_bokar = hofundur_bokar;
        this.dagurstofnad = dagurstofnad;
        if(tyngdarstig==1){
            this.tyngdarstig_heiti= "Létt";
        }
        if(tyngdarstig==2){
            this.tyngdarstig_heiti= "Miðlungs";
        }
        if(tyngdarstig==3){
            this.tyngdarstig_heiti= "Erfið";
        }
        if(tyngdarstig==0){
            this.tyngdarstig_heiti="Ekkert erfiðleikastig er á spurningunni";
        }
        this.namsgrein_afanganr=namsgrein_afanganr;
        this.bok_heiti=bok_heiti;

    }

    public Question(int spurningar_id, String tegund, String texti, String afangi_id, int tyngdarstig, String kennari_id, Date edit, String bok_heiti, String namsgrein_afanganr) {
        this.spurningar_id = spurningar_id;
        this.tegund = tegund;
        this.onn_id = onn_id;
        this.texti = texti;
        this.afangi_id = afangi_id;
        this.tyngdarstig = tyngdarstig;
        this.kennari_id = kennari_id;
        this.kafli = kafli;
        this.vidhengi = vidhengi;
        this.nr_utgafu = nr_utgafu;
        this.hofundur_bokar = hofundur_bokar;
        this.dagurstofnad = dagurstofnad;
        if(tyngdarstig==1){
            this.tyngdarstig_heiti= "Létt";
        }
        if(tyngdarstig==2){
            this.tyngdarstig_heiti= "Miðlungs";
        }
        if(tyngdarstig==3){
            this.tyngdarstig_heiti= "Erfið";
        }
        if(tyngdarstig==0){
            this.tyngdarstig_heiti="Ekkert erfiðleikastig er á spurningunni";
        }
        this.namsgrein_afanganr=namsgrein_afanganr;
        this.bok_heiti=bok_heiti;
        this.dagurbreytt = edit;

    }


    public Question(int spurningar_id ,String tegund, int onn_id, String texti, String afangi_id, int tyngdarstig, String kennari_id, String kafli, Http.MultipartFormData.FilePart vidhengi, String nr_utgafu, String hofundur_bokar, String dagurbuidtil, List<Leitarskilyrdi> tags,String bok_heiti, String namsgrein_afanganr) {
        this.spurningar_id = spurningar_id ;
        this.tegund = tegund;
        this.onn_id = onn_id;
        this.texti = texti;
        this.afangi_id = afangi_id;
        this.tyngdarstig = tyngdarstig;
        this.kennari_id = kennari_id;
        this.kafli = kafli;
        this.vidhengi = vidhengi;
        this.nr_utgafu = nr_utgafu;
        this.hofundur_bokar = hofundur_bokar;
        this.dagurbuidtil = dagurbuidtil;
        this.tags = tags;
        this.bok_heiti = bok_heiti;
        this.namsgrein_afanganr = namsgrein_afanganr;
        if(tyngdarstig==1){
            this.tyngdarstig_heiti= "Létt";
        }
        if(tyngdarstig==2){
            this.tyngdarstig_heiti= "Miðlungs";
        }
        if(tyngdarstig==3){
            this.tyngdarstig_heiti= "Erfið";
        }
        if(tyngdarstig==0){
            this.tyngdarstig_heiti="Ekkert erfiðleikastig er á spurningunni";
        }


    }





}

